<!DOCTYPE html>
<html>
	<head>
		<meta charset="utf-8">
		<title>编写四则运算</title>
		<script>
			function account(){
				var op1=prompt("请输入第一个数：","");
				var op2=prompt("请输入第二个数：","");
				var sign=prompt("请输入运算符：","");
				var result;
				opp1=parseFloat(op1);
			   opp2=parseFloat(op2);
				switch(sign){
					case "+":
						result=opp1+opp2;
						break;
					case "-":
							result=opp1-opp2;
							break;
					case "*":
						result=opp1*opp2;
						break;
					default:
						result=opp1/opp2;
						break;
				}
				alert("结果为"+opp1+sign+opp2+"="+result);
			}
		</script>
	</head>
	<body>
		<input type="button"  value="计算两数运算结果"  onclick="account()"/>
	</body>
</html>
